class Solution {
    public static void swap(int[] nums,int dest,int cur) {
        int tmp = nums[dest];
        nums[dest] = nums[cur];
        nums[cur] = tmp;
    }
    public void moveZeroes(int[] nums) {
        int cur = 0,dest = -1;
        while(cur < nums.length) {
            if(nums[cur] == 0) {
                cur++;
            }
            else {
                dest++;
                swap(nums,dest,cur);
                cur++;
            }
        }
    }
}